<template>
  <el-dropdown trigger="click">
    <el-button type="primary">
      操作<i class="el-icon-arrow-down el-icon--right"></i>
    </el-button>
    <template #dropdown>
      <el-dropdown-menu>
        <el-dropdown-item
          v-for="(item, index) in buttonInfo"
          :key="index"
          @click="defineEvent(rowData)"
          class="dropdown-button"
        >
          <el-button :type="item.type">
            {{ item.label }}
          </el-button>
        </el-dropdown-item>
      </el-dropdown-menu>
    </template>
  </el-dropdown>
</template>

<script>
export default {
  name: "DropDown",
  props: {
    buttonInfo: {
      required: true,
      type: Array
    },
    rowData: {
      required: true,
      type: Object
    }
  },
  setup() {
    const defineEvent = (data) => {};
    return {
      defineEvent
    };
  },
};
</script>

<style scoped>
.dropdown-button {
  margin-bottom: 10px;
}
.dropdown-button:last-child {
  margin-bottom: 0;
}
</style>
